/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package session;

import entity.Serie;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Lisha
 */
@Stateless
public class SerieFacade extends AbstractFacade<Serie> {
    @PersistenceContext(unitName = "emangaPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public SerieFacade() {
        super(Serie.class);
    }
    
    public List<Serie> findByCategoryId(Short s) {
        Query q = em.createNamedQuery("Serie.findByCategoryId");
        q.setParameter("categoryId", s);
        return q.getResultList();
    }
}
